﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _5.CheckNeighboursAreBigger
{
    class CheckNeighboursAreBigger
    {
        public static int length;
        static bool CheckIfInside(int[] myarray1, int i)
        {
            return 0 <= i && i < myarray1.Length;
        }
        static bool CheckIfItBigger(int[] myarray1, int i,int j)
        {
            return CheckIfInside(myarray1, j) ? myarray1[i] > myarray1[j] : true;
        }
        static bool CheckIfItBiggerByNeighb(int[] myarray1, int i)
        {
            return CheckIfItBigger(myarray1, i, i - 1) && CheckIfItBigger(myarray1, i, i + 1);
        }
        static int CheckElementIfBiggerThanNeigh(int[] myarray1)
        {
            for (int i = 0; i < myarray1.Length; i++)
            {
                if (CheckIfItBiggerByNeighb(myarray1, i)) return i;
            }
            return -1;
        }

        static void Main(string[] args)
        {
            Console.WriteLine("Lenght of array:");
            length = int.Parse(Console.ReadLine());
            int[] myarray;
            myarray = new int[length];
            for (int i = 0; i < length; i++)
            {
                Console.Write("[{0}] = ", i);
                myarray[i] = int.Parse(Console.ReadLine());
            }
            for (int i = 0; i < myarray.Length; i++)
            {
                Console.WriteLine(CheckElementIfBiggerThanNeigh(myarray));
            }
        }
    }
}
